#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include "testutils.h"

void outpost_test()
{
  int i, j, pass, coin_bonus;
  struct gameState state;

  for(i = 0; i < MAX_ITERATIONS; i++){
    coin_bonus = 0;
    pass = 0;
    init_test_data(&state, 1);

    srand(time(NULL));

    state.deckCount[0] = 50;
    for(j = 0; j < state.deckCount[0]; j++){
      state.deck[0][j] = random_card();
    }

    state.handCount[0] = 5;
    for(j = 0; j < state.handCount[0] - 1; j++){
      state.hand[0][j] = random_card();
    }
    
    state.hand[0][4] = outpost;

    printf("ITERATION %d\n", i);

    if(cardEffect(state.hand[0][4], -1, -1, -1, &state, 4, &coin_bonus) == -1)
      printf("Failure, card effect not returned\n");
    else
      pass++;

    if(state.outpostPlayed == 1)
      pass++;
    else
      printf("Failure, outpost flag not set\n");

    if(pass == 2)
      printf("Success, outpost flag set\n");
  }
}

int main()
{
  outpost_test();
  return 0;
}
